package huawei.exam1;

import java.util.Scanner;

/**
 * @author : Rookie
 * @description :
 * @date : 2022/11/16
 */
public class HJ2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String str1 = scanner.nextLine();
            String str2 = scanner.nextLine();
            int count = 0;
            String[] str1Arr = str1.split("");
            for (String s : str1Arr) {
                if (s.equalsIgnoreCase(str2)) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
